Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix job backoff limit for restart policy Never #93779

Conversation

yodarshafrir1
Copy link
Contributor

@yodarshafrir1 yodarshafrir1 commented Aug 7, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
The Job controller currently uses NumRequeues to decide wether or not the job has exceeded the backoffLimit. NumRequeues represents the number of times a job has been requeued, a requeue can occur due to several reasons and not only for Fail events. This makes backoffLimit unpredictable.

This PR sets the job controller to use the number of Failed pods to decide if the job has exceeded the backoffLimit.

According to the documentation: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/apps/job.md#backoff-policy-and-failed-pod-limit

For Never we count actual pod failures (reflected in .status.failed field). With OnFailure, we take an approximate value of pod restarts (as reported in .status.containerStatuses[*].restartCount).

For restart policy of OnFailure - the logic is handled in pastBackoffLimitOnFailure as described above.
For restart policy of Never - this PR fixes the logic to be as described above.

This solution has been discussed in the past by @janetkuo in: #70251 (comment)

Which issue(s) this PR fixes:

Fixes #93559, #92245, #70251, #64787

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 7, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @yodarshafrir1!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @yodarshafrir1. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 7, 2020
@yodarshafrir1
Copy link
Contributor Author

/assign @erictune

@yodarshafrir1 yodarshafrir1 changed the title Fix job's backoff limit for restart policy Never, rely on number of f… Fix job backoff limit for restart policy Never Aug 7, 2020
@georgettica
Copy link

Wow! Thanks so much for the PR! Can't wait to use this on my cluster

@kow3ns
Copy link
Member

kow3ns commented Aug 10, 2020

/assign @soltysh

@kow3ns
Copy link
Member

kow3ns commented Aug 10, 2020

/unassign @erictune

@pigletfly
Copy link
Member

/ok-to-test
/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 11, 2020
Remove patch in e2e test of backoff limit due to usage of NumRequeues
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Aug 11, 2020
@yodarshafrir1
Copy link
Contributor Author

/retest

2 similar comments
@yodarshafrir1
Copy link
Contributor Author

/retest

@yodarshafrir1
Copy link
Contributor Author

/retest

@georgettica
Copy link

tests are passing, can someone PTAL?

@yodarshafrir1
Copy link
Contributor Author

yodarshafrir1 commented Aug 15, 2020

pinging @soltysh, @smarterclayton, @krmayankk for reviews/comments please

@yodarshafrir1
Copy link
Contributor Author

yodarshafrir1 commented Aug 31, 2020

@soltysh @smarterclayton @krmayankk could you please review?

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh, yodarshafrir1

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2020
@yodarshafrir1
Copy link
Contributor Author

/test pull-kubernetes-integration

@yodarshafrir1
Copy link
Contributor Author

/test pull-kubernetes-conformance-kind-ga-only-parallel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

job fails before the .spec.backoffLimit
7 participants